package com.eastfair.imaster.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.imaster.dto.*;
import com.eastfair.imaster.enumeration.BusinResourceCorrelationTypeEnum;
import com.eastfair.imaster.enumeration.BusinResourceResourceTypeEnum;
import com.eastfair.imaster.enumeration.BusinResourceStatusEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 业务资源表
 * </p>
 *
 * @author ligang
 * @since 2022-01-20
 */
@Data
public class BusinResourceVO implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    private Long projectId;
    /**
     * 关联身份#{user:用户;exhibitor:展商;project:项目;sponsor:主办}
     */
    @ApiModelProperty(value = "关联身份#{user:用户;exhibitor:展商;project:项目;sponsor:主办}")
    private BusinResourceCorrelationTypeEnum correlationType;
    /**
     * 关联ID
     */
    @ApiModelProperty(value = "关联ID")
    private Long correlationId;

    /**
     * 资源标题
     */
    @ApiModelProperty(value = "资源标题")
    private String title;

    /**
     * 富文本
     */
    @ApiModelProperty(value = "富文本")
    private String richText;

    /**
     * 附属业务详情json格式
     */
    @ApiModelProperty(value = "附属业务详情json格式")
    private String businDetails;

    /**
     * 附属业务--新闻
     */
    @ApiModelProperty(value = "附属业务--新闻")
    @NotNull(groups = {BusinResourceDTO.saveNews.class}, message = "附属业务--新闻 不能为空")
    private ResourceOfNew resourceOfNew;

    /**
     * 附属业务--资料
     */
    @ApiModelProperty(value = "附属业务--资料")
    @NotNull(groups = {BusinResourceDTO.saveData.class}, message = "附属业务-资料 不能为空")
    private List<ResourceOfFile> resourceOfFileList;

    /**
     * 附属业务--视频
     */
    @ApiModelProperty(value = "附属业务--视频")
    @NotNull(groups = {BusinResourceDTO.saveData.class}, message = "附属业务-视频 不能为空")
    private List<ResourceOfVideo> resourceOfVideoList;



    /**
     * 文件地址，单个文件
     */
    @ApiModelProperty(value = "文件地址，单个文件")
    @Size(max = 255, message = "文件地址，单个文件长度不能超过255")
    private String url;
    /**
     * 状态 #{normal:正常;wait_init:待初始化;forbidden:禁用;waiting:待审核;refuse:拒绝}
     */
    @ApiModelProperty(value = "状态 #{normal:正常;wait_init:待初始化;forbidden:禁用;waiting:待审核;refuse:拒绝}")
    private BusinResourceStatusEnum status;
    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    private Integer sequence;
    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnable;
    /**
     * 是否删除(默认0：未删除1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除1:已删除)")
    private Integer isDeleted;

    /**
     * 资源类型#{news:新闻;video:视频}
     */
    @ApiModelProperty(value = "资源类型#{news:新闻;video:视频}")
    private BusinResourceResourceTypeEnum resourceType;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime createTime;

    /**
     * 是否上下架 1是 0否
     */
    @ApiModelProperty(value = "是否上下架 1是 0否")
    @TableField(value = "is_shelves")
    @Excel(name = "是否上下架 1是 0否")
    private Integer isShelves;

    /**
     * 前端用视频数组
     */
    private String advertsVideo;
    /**
     * 前端用视频封面图数组
     */
    private String advertsVideoImage;

    /**
     * 前端用视频简介
     */
    private String videoText;
}
